package com.tgy;

public class _07_递归 {

   private static int factorial(int n){

     if (n <= 1 ){

       return 1;
     }

     return factorial(n - 1 ) + n;
  }

  private static int factorial01(int n,int result){

    if (n <= 0 ){

      return result;
    }

    return factorial01(n - 1, n + result );
  }

  public static void main(String[] args) {

//    System.out.println(factorial(10000));
    System.out.println(factorial01(10000,0));
  }
}
